
package com.insigma.business.qrcode.common.converter;


import com.insigma.business.qrcode.intell.dto.CompanyEntryApplyDTO;
import com.insigma.business.qrcode.intell.dto.CompanyEntryApplyInsertRequest;
import com.insigma.business.qrcode.intell.dto.CompanyEntryApplySearchRequest;
import com.insigma.business.qrcode.intell.dto.CompanyEntryApplyUpdateRequest;
import com.insigma.business.qrcode.soldier.dto.CompanyEntryApplyBSearcher;
import com.insigma.business.qrcode.soldier.entity.CompanyEntryApplyDO;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class CompanyEntryApplyProviderConverter extends AbstractConverter<CompanyEntryApplyDTO, CompanyEntryApplyDO> {

    private final static CompanyEntryApplyProviderConverter companyEntryApplyConverter = new CompanyEntryApplyProviderConverter();

    private CompanyEntryApplyProviderConverter(){}

    
    public static CompanyEntryApplyBSearcher convertRequestSO2Searcher(final CompanyEntryApplySearchRequest request){
        final CompanyEntryApplyBSearcher companyEntryApplyBSearcher = new CompanyEntryApplyBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,companyEntryApplyBSearcher);
        return companyEntryApplyBSearcher;
    }

    
    public static CompanyEntryApplyDO convertRequestUO2DO(final CompanyEntryApplyUpdateRequest companyEntryApplyUpdateRequest) {
        final CompanyEntryApplyDO companyEntryApplyDO = new CompanyEntryApplyDO();
        BeanUtils.copyProperties(companyEntryApplyUpdateRequest,companyEntryApplyDO);
        
        return companyEntryApplyDO;
    }

    
    public static CompanyEntryApplyDO convertRequestIO2DO(final CompanyEntryApplyInsertRequest companyEntryApplyInsertRequest) {
        final CompanyEntryApplyDO companyEntryApplyDO = new CompanyEntryApplyDO();
        BeanUtils.copyProperties(companyEntryApplyInsertRequest,companyEntryApplyDO);
        return companyEntryApplyDO;
    }

    
    public static List<CompanyEntryApplyDTO> convertResponseDOList2DTOList(final List<CompanyEntryApplyDO> companyEntryApplyDOList){
        return companyEntryApplyConverter.convertGenericResponseDOList2DTOList(companyEntryApplyDOList);
    }

    
    public static CompanyEntryApplyDTO convertResponseDO2DTO(final CompanyEntryApplyDO companyEntryApplyDO){
        return companyEntryApplyConverter.convertGenericResponseDO2DTO(companyEntryApplyDO);
    }

    
    @Override
    protected CompanyEntryApplyDTO doConvertResponseDO2DTO(CompanyEntryApplyDO companyEntryApplyDO) {
        final CompanyEntryApplyDTO companyEntryApplyDTO = new CompanyEntryApplyDTO();
        try {
            BeanUtils.copyProperties(companyEntryApplyDO, companyEntryApplyDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return companyEntryApplyDTO;
    }

}
